export enum Rotation {
  Clockwise = -1,
  Counterclockwise = 1,
}
type Coord = [number, number];
export function rotate(coords: Coord[], dir: Rotation, offset: number = 0) {
  return coords
    .map(([x, y]) =>
      <Coord>[dir * (y - offset) + offset, -dir * (x - offset) + offset]);
}